<?php

/**
 * @author  吴珊珊
 * @date 2017/11/8 
 * 未找到模型
 */

namespace App\Http\Requests\Common\CatData\Image;

use App\Http\Requests\Request;

class ImgtplRequest extends Request
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        switch($this->method())
        {
            case 'GET':
            case 'DELETE':
            {
                return [];
            }
            // Crate
            case 'POST':
            {
                return [
                    'name' => 'required|max:100',
        'title' => 'max:100',
        'short_desc' => 'required|max:100',
        'ratio' => 'max:100',
        'orient' => 'max:100'
                ];
            }
            // UPDATE
            case 'PUT':
            case 'PATCH':
            {
                // $id = $this->route('imgtpls');
                return [
                    'name' => 'required|max:100',
        'title' => 'max:100',
        'short_desc' => 'required|max:100',
        'ratio' => 'max:100',
        'orient' => 'max:100'
                ];
            }
            default:
                break;
        }
    }
}
